﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LED_Tester
{
    public partial class frmMode : Form
    {
        public frmMode()
        {
            InitializeComponent();
        }

        private string code;

        private bool isAdmin;

        private bool isSuperAdmin;

        public string Code
        {
            get { return code; }
            set { code = value; }
        }

        public bool IsAdmin
        {
            get { return isAdmin; }
            set { isAdmin = value; }
        }

        public bool IsSuperAdmin
        {
            get { return isSuperAdmin; }
            set { isSuperAdmin = value; }
        }

        private void btnAccpet_Click(object sender, EventArgs e)
        {
            if (txtCode.Text == string.Empty)
            {
                MessageBox.Show("请输入密码！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (txtCode.Text == code)
            {
                isAdmin = true;
                MessageBox.Show("进入管理员模式！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (txtCode.Text == "dpfms009")
            {
                isSuperAdmin = true;
                MessageBox.Show("进出超级管理员模式！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                isAdmin = false;
                isSuperAdmin = false;
                MessageBox.Show("密码错误！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            DialogResult = DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

    }
}
